home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.3 KB | 37 lines | [TEXT/GEOL] |
- Item 2129697 14-Jan-88 18:40
-
- From: WILSON6 Wilson, Dave - Personal Concepts
-
- To: MACAPP$ MacApp Interest List
-
- Sub: Unsafe use of handles
-
- The MPW Pascal compiler currently checks for handles used as VAR parameters in
- Function and Procedure calls, and warns you about "Unsafe use of a handle".
- This of course is also checked for fields of an object. This is good, but
- doesn't go far enough, because there are numerous other opportunities to screw
- up that I do not believe the compiler will catch. These are covered in
- Knaster's first book in detail.
-
- As nearly as I can understand, the following might be dangerous:
-
- ROMCallABC(fEnclosingRect);
- Data structures larger than 4 bytes have their address pushed on the stack
- - even if they are being passed by value.
-
- SELF.fShapeList := NewList;
- The function call may move the object on the heap, after the address of
- the data field is computed.
-
- aShape := MyShapeFactory(x,y,z);
- Note that this could be a problem even if MyShapeFactory did not allocate
- memory - IF it were in a nonresident CODE segment that had to be loaded into
- memory.
-
- Am I being too paranoid, or are these potential problems? If so, then the
- compiler should be changed to warn you about these also.
-
- Dave
-
-
-